import time


def b_sort(s):
    for i in range(len(s) - 1):
        for j in range(len(s) - i - 1):
            if s[j] > s[j + 1]:
                s[j], s[j + 1] = s[j + 1], s[j]


def read_l(filename):
    f = open(filename)
    d = f.readlines()
    return d


m1 = read_l("m1_sorted.txt")
m2 = read_l("m2_reverse.txt")
m3 = read_l("m3_shuffle.txt")
print(m1)
print(m2)
t_s = time.time()
b_sort(m1)
t_f = time.time()
print("m1_sorted", round((t_f - t_s) * 1000), "milliseconds")

t_s = time.time()
b_sort(m2)
t_f = time.time()
print("m2_reverse", round((t_f - t_s) * 1000), "milliseconds")

t_s = time.time()
b_sort(m3)
t_f = time.time()
print("m3_shuffle", round((t_f - t_s) * 1000), "milliseconds")